package com.lfgroup.cloud.consumer.ribbon.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.client.RestTemplate;

import com.lfgroup.cloud.consumer.ribbon.entity.User;


@RestController
public class UserController {


    @Autowired
    private RestTemplate restTemplate;
    
    @GetMapping("/ribbon/{id}")
    public User getUserByid(@PathVariable Long id){

        return this.restTemplate.getForObject("http://microservice-provider/provider/"+id,User.class);
    }
}
